package com.ruoyi.common.utils.timeBetween;

import java.time.LocalTime;
import java.util.List;

public class TradeTimeConfig {
    private List<TimeRange> timeRanges;

    public static class TimeRange {
        private LocalTime start;
        private LocalTime end;

        public LocalTime getStart() { return start; }
        public LocalTime getEnd() { return end; }
        public void setStart(LocalTime start) { this.start = start; }
        public void setEnd(LocalTime end) { this.end = end; }
    }

    public boolean isInTradeTime(LocalTime currentTime) {
        return timeRanges.stream().anyMatch(range ->
            !currentTime.isBefore(range.getStart()) &&
                !currentTime.isAfter(range.getEnd())
        );
    }

    public List<TimeRange> getTimeRanges() { return timeRanges; }
    public void setTimeRanges(List<TimeRange> timeRanges) {
        this.timeRanges = timeRanges;
    }
}
